package com.lai.berry_core.app;

import android.content.Context;

import com.google.gson.Gson;

import java.util.HashMap;

/**
 * create by lai
 * final
 */
public final class Berry {
    public static Configurator init(Context context){
         getConfigurations().put(ConfigKeys.APPLICATION_CONTEXT,context);
         getConfigurations().put(ConfigKeys.GSON,new Gson());
        return Configurator.getInstance();
    }

    public static HashMap<Object,Object> getConfigurations(){
        return Configurator.getInstance().getBerryConfigs();
    }
    public static Gson getGson(){
        return getConfiguration(ConfigKeys.GSON);
    }

    public static Context getApplicationContext() {
        return getConfiguration(ConfigKeys.APPLICATION_CONTEXT);
    }
    public static <T> T getConfiguration(Object key) {
        return getConfigurator().getConfiguration(key);
    }
    public static Configurator getConfigurator() {
        return Configurator.getInstance();
    }
}
